Namespace definitions

The rell.test namespace is only accessible within test modules

Example

@test module;

function test() {
rell.test.block().run();
}

Since

0.10.4

Types

Link copied to clipboard
type block

Represents a block builder which can build a block on the blockchain.

Link copied to clipboard
type failure
Link copied to clipboard
struct keypair

Keypair that can be used for testing.

Link copied to clipboard
type op

Represent a operation that can be included in a transaction.

Link copied to clipboard
type tx

Represents a transaction builder that can build a block containing this transacation on the blockchain.

Properties

Link copied to clipboard

Time interval in milliseconds between current block and next block to be used.

Link copied to clipboard

Keypair that signs all blocks built in the test context.

Link copied to clipboard

Default time interval in milliseconds between each block. (10 seconds)

Link copied to clipboard

Timestamp in milliseconds of the first block by default. (2020-01-01 00:00:00 UTC)

Link copied to clipboard

Timestamp in milliseconds of the previous block. Read will fail if no block has been built.

Link copied to clipboard

Timestamp in milliseconds of the previous block or null if no block has been built.

Link copied to clipboard

Timestamp in milliseconds which will be used for the next block.

Functions

Link copied to clipboard
function <T> assert_equals(actual: T, expected: T)

Asserts that two values are equal.

Link copied to clipboard
function assert_events(expected: (text, gtv)...)

Asserts that the expected events has been emitted during last block

Link copied to clipboard
function <T> assert_fails(fn: () -> T): rell.test.failure

Asserts that a function fails to evaluate

function <T> assert_fails(expected_message: text, fn: () -> T): rell.test.failure

Asserts that a function fails with an expected message

Link copied to clipboard
function assert_false(actual: boolean)

Asserts that the value is false.

Link copied to clipboard
function <T: -comparable> assert_ge(actual: T, expected: T)

Asserts that the value is greater than or equal to the expected value

Link copied to clipboard
function <T: -comparable> assert_ge_le(actual: T, expected1: T, expected2: T)

Asserts that the value is greater than or equal to the first value and less than or equal to the second value.

Link copied to clipboard
function <T: -comparable> assert_ge_lt(actual: T, expected1: T, expected2: T)

Asserts that the value is greater than or equal to the first value and less than the second value.

Link copied to clipboard
function <T: -comparable> assert_gt(actual: T, expected: T)

Asserts that the value is greater than the expected value

Link copied to clipboard
function <T: -comparable> assert_gt_le(actual: T, expected1: T, expected2: T)

Asserts that the value is greater than the first value and less than or equal to the second value.

Link copied to clipboard
function <T: -comparable> assert_gt_lt(actual: T, expected1: T, expected2: T)

Asserts that the value is greater than the first value and less than the second value.

Link copied to clipboard
function <T: -comparable> assert_le(actual: T, expected: T)

Asserts that the value is less than or equal to the expected value

Link copied to clipboard
function <T: -comparable> assert_lt(actual: T, expected: T)

Asserts that the value is less than the expected value

Link copied to clipboard
function <T> assert_not_equals(actual: T, illegal: T)

Asserts that two values are not equal.

Link copied to clipboard
function <T: -any> assert_not_null(actual: T?)

Asserts that the value is not null.

Link copied to clipboard
function assert_null(actual: anything)

Asserts that the value is null.

Link copied to clipboard
function assert_true(actual: boolean)

Asserts that the value is true.

Link copied to clipboard
function get_events(): list<(text, gtv)>

Get all events that have been emitted from the last block.

Link copied to clipboard
function nop(): rell.test.op

Creates a new no-op operation.

function nop(x: integer): rell.test.op
function nop(x: text): rell.test.op

Creates a new no-op operation with a given nonce.

Link copied to clipboard
function set_block_interval(interval: integer): integer

Set the time interval in milliseconds between current block and the next one. This property is not respected if a timestamp has been explicitly set by calling rell.test.set_next_block_time.

Link copied to clipboard

Explicitly set the timestamp in milliseconds to use on the next block.

Link copied to clipboard

Explicitly set the timestamp in milliseconds to use on next block by specifying a time delay from the last block.